package com.lmx.repoDomain.repository;

import io.katharsis.repository.annotations.JsonApiResourceRepository;
import io.katharsis.repository.annotations.JsonApiSave;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lmx.persistence.service.CustomerPreferenceService;
import com.lmx.repoDomain.tmodel.CustomerPreference;

@JsonApiResourceRepository(CustomerPreference.class)
@Component
public class CustomerPreferenceReository extends
		BaseRepository<CustomerPreference> {
	@PostConstruct
	public void init() {
		dslJpaService.setEntityClass(CustomerPreference.class);
	}

	@Autowired
	CustomerPreferenceService srv;

	@Override
	@JsonApiSave
	public CustomerPreference save(final CustomerPreference entity) {
		if (entity.getId() == null) {
			super.save(entity);
		}
		return this.srv.update(entity);
	}
}
